package io.kiki.sba.registry.common.model.metaserver.cleaner;


import lombok.Getter;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

@Getter
public class AppRevisionSlice implements Serializable {
    private final Set<String> revisions;

    public AppRevisionSlice(Set<String> revisions) {
        this.revisions = revisions;
    }

    public static AppRevisionSlice merge(Collection<AppRevisionSlice> slices) {
        Set<String> revisions = new HashSet<>();
        for (AppRevisionSlice slice : slices) {
            revisions.addAll(slice.revisions);
        }
        return new AppRevisionSlice(revisions);
    }

}
